package com.wjv.example.common.entity;

import java.io.Serializable;

/**
 * <p>Title: ResultInfo</p>
 * <p>Company:misspao </p>
 *
 * @author: wjv
 * @Date: Create in 17:05 2020/9/21
 * @Description:
 */
public class ResultInfo implements Serializable {
    private int code;

    private String message;

    private Object data;

    public static ResultInfo ok(Object data) {
        return new ResultInfo(200, "success", data);
    }

    public static ResultInfo ok(String msg, Object data) {
        return new ResultInfo(200, msg, data);
    }

    public static ResultInfo okMsg(String message) {
        return new ResultInfo(200, message, null);
    }

    public static ResultInfo error(String message) {
        return new ResultInfo(-1, message, null);
    }

    public ResultInfo() {
    }

    public ResultInfo(int code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
